<!--<?php
$saleUrl = PW_HouseUrl::manage();
$hireUrl = PW_HouseUrl::hireManage();
print <<<EOT
-->
<script language="Javascript" src="mode/house/js/manage.js"></script>

<form action="{$_viewer->baseUrl}a=hire&" method="post" name="form">
	<div class="fr w-773">
			<div class="house-box">
				<div class="filter">
					<ul class="terms">
						<li {$_viewer->current['publish']}><a href="{$_viewer->baseUrl}a=hire">已发布房源</a></li>
						<li {$_viewer->current['prepare']}><a href="{$_viewer->baseUrl}a=hire&type=prepare">待发布房源</a></li>
						<li {$_viewer->current['expired']}><a href="{$_viewer->baseUrl}a=hire&type=expired">已过期房源</a></li>
					</ul>
					<div class="pagination">
						{$_viewer->pages}
					</div>
				</div>
<!--
EOT;
if (!empty($_viewer->result)) {
print <<<EOT
-->	
				<div class="list-house">
					<table width="100%" cellpadding="0" cellspacing="0">
						<colgroup>
							<col class="col-0" />
							<col class="col-1" />
							<col class="col-2" />
							<col class="col-3" />
							<col class="col-4" />
						</colgroup>
						<thead>
							<th class="tac"><input id="check-all-1" type="checkbox" name="houses" onclick="CheckAll(document.form,this)" /></th>
							<th><label for="check-all-1">全选/反选</label></th>
							<th>信息标题/内容</th>
<!--
EOT;
if ($_viewer->type == 'publish') {
print <<<EOT
-->
							<th>房源推广</th>
							<th>操作</th>
						</thead>
<!--
EOT;
} else {
print <<<EOT
-->
							<th></th>
							<th>操作</th>
						</thead>
<!--
EOT;
}
foreach($_viewer->result as $value){
$url = PW_HouseUrl::hireInfo($value['houseid']);
$value[postdate] = get_date($value[posttime]);
print <<<EOT
-->
					<tbody>
						<tr>
							<td class="tac"><input type="checkbox" name="houses" value="$value[houseid]" /></td>
<!--
EOT;
if ($value['state'] != 2) {
print <<<EOT
-->
							<td class="vt"><div class="pic"><a href="{$url}"><img src="$value[thumb]" width="105" height="80" /></a></div></td>
							<td><div class="summary">
								<h3><a href="{$url}">{$value[subject]}</a></h3>
<!--
EOT;
} else {
print <<<EOT
-->
							<td class="vt"><div class="pic"><a href="{$_viewer->baseUrl}a=addhire&houseid={$value[houseid]}&from={$_viewer->type}"><img src="$value[thumb]" width="105" height="80" /></a></div></td>
							<td><div class="summary">
								<h3><a href="{$_viewer->baseUrl}a=addhire&houseid={$value[houseid]}&from={$_viewer->type}">{$value[subject]}</a></h3>
<!--
EOT;
}
print <<<EOT
-->
								<ul class="attr">
									<li><span>{$value[village]}</span><span>{$value[address]}</span></li>
									<li><span>{$value[room]}</span><span>楼层:{$value[currentfloor]}/{$value[totalfloor]}层 </span></li>
									<li class="data"><span>{$value[acreage]}平米</span><span class="price">{$value[price]}元/月</span></li>
<!--
EOT;
if ($_viewer->type == 'publish') {
$expired = ceil(($_viewer->expiredTime[$value['houseid']]['expiredtime'] - $GLOBALS['timestamp'])/86400);
$expiredString = $expired > 0 ? "剩余{$expired}天过期" : "已过期";
print <<<EOT
-->
									<li class="time">发布：$value[postdate] ($expiredString)</li>
<!--
EOT;
$urgent = '';
if ($value[isurgent]) {
$urgent = '加急至 ' .  date('Y-m-d', $_viewer->urgentState[$value['houseid']]['expiredtime']);
}
$top = '';
if ($value[istop]) {
$top = '置顶至 ' .  date('Y-m-d', $_viewer->topState[$value['houseid']]['expiredtime']);
}
}
print <<<EOT
-->
								</ul>
								</div></td>
								<td>
									$urgent
									<br/>
									$top
								</td>
								<td><ul class="options">
<!--
EOT;
if ($_viewer->type == 'publish') {
print <<<EOT
-->
									<li>
										<span><a href="javascript:;" onclick="refreshHouse('{$_viewer->baseUrl}link=hire&','{$value[houseid]}');">刷新</a></span>
<!--
EOT;
if($_viewer->right[urgent]){
print <<<EOT
-->
										<span><a href="javascript:;" onclick="sendmsg('{$_viewer->baseUrl}a=urgent&link=hire&houseid={$value[houseid]}');">加急</a></span>
<!--
EOT;
}
print <<<EOT
-->
									</li>
									<li>
										<span><a href="{$_viewer->baseUrl}a=addhire&houseid={$value[houseid]}&from={$_viewer->type}">编辑</a></span>
<!--
EOT;
if($_viewer->right[top]){
print <<<EOT
-->
										<span><a href="javascript:;" onclick="sendmsg('{$_viewer->baseUrl}a=top&link=hire&houseid={$value[houseid]}');">置顶</a></span>											
<!--
EOT;
}
print <<<EOT
-->
									</li>											
<!--
EOT;
} else {
print <<<EOT
-->
									<li>
										<span><a href="{$_viewer->baseUrl}a=addhire&houseid={$value[houseid]}&from={$_viewer->type}">编辑</a></span>
										<span><a href="javascript:;" onclick="deleteHouse({$value[houseid]},'{$_viewer->baseUrl}link=hire&');">删除</a></span>
									</li>											
<!--
EOT;
}
print <<<EOT
-->
								</ul></td>
							</tr>											
<!--
EOT;
}
print <<<EOT
-->
						</tbody>
					</table>
				</div>
				<div class="list-manage">
					<span class="check-all">
						<input type="checkbox" value="" name="houses" onclick="CheckAll(document.form,this)" id="check-all-2"><label for="check-all-2">全选/反选</label></span>
<!--
EOT;
if ($_viewer->type == 'publish') {
print <<<EOT
-->
						<a href="javascript:;" onclick="exceptHouse(document.form,'{$_viewer->baseUrl}link=hire&');" class="option">下架</a>							
<!--
EOT;
} elseif ($_viewer->type == 'prepare') {
print <<<EOT
-->
						<a href="javascript:;" onclick="upHouse(document.form,'{$_viewer->baseUrl}link=hire&');" class="option">上架</a>							
<!--
EOT;
}
print <<<EOT
-->
						<a href="javascript:;" onclick="deleteHouses(document.form,'{$_viewer->baseUrl}link=hire&');" class="option">删除</a>
					
					<div class="pagination">
						{$_viewer->pages}
					</div>
				</div>
<!--
EOT;
} elseif ($_viewer->type == 'publish') {
print <<<EOT
-->	
				<div id="alert-page">
					<table cellspacing="0" cellpadding="0">
						<tr>
							<td><img src="mode/house/images/sendhand/sorry.gif" /></td>
							<td><h2>您还没有正在发布的出租房源</h2></td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td><div class="action"><a class="do" href="{$_viewer->baseUrl}a=addhire"><span>点此马上发布</span></a><a class="do" href="{$_viewer->baseUrl}a=hire&type=prepare"><span>查看待发布房源</span></a></div></td>
						</tr>
					</table>
				</div>
<!--
EOT;
} elseif ($_viewer->type == 'prepare') {
print <<<EOT
-->	
				<div id="alert-page">
					<table cellspacing="0" cellpadding="0">
						<tr>
							<td><img src="mode/house/images/sendhand/sorry.gif" /></td>
							<td><h2>暂无待发布房源</h2></td>
						</tr>
					</table>
				</div>
<!--
EOT;
} elseif ($_viewer->type == 'expired') {
print <<<EOT
-->	
				<div id="alert-page">
					<table cellspacing="0" cellpadding="0">
						<tr>
							<td><img src="mode/house/images/sendhand/sorry.gif" /></td>
							<td><h2>暂无已过期房源</h2></td>
						</tr>
					</table>
				</div>
<!--
EOT;
}
print <<<EOT
-->
			</div>
		</div>
</form>																																																	
<!--
EOT;
?>-->